package com.stm.bi.enums;


import com.stm.framework.annotation.EnumValue;

/**
 * @author chenyingjun
 * @ClassDesc ES时间类型枚举
 * @date 2023/02/02 9:20
 **/
@EnumValue
public enum GroupType {
    SUM("sum", "合计"),
    AVG("avg", "平均"),
    COUNT("count", "计数"),
    MAX("max", "最大"),
    MIN("min", "最小"),
    MEDIAN("median", "中位数");

    /**
     * 字段类型值
     */
    @EnumValue
    private final String value;
    /**
     * 字段类型描述
     */
    
    private final String desc;

    GroupType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static GroupType getGroupType(String value) {
        for (GroupType ut : GroupType.values()) {
            if (ut.getValue().equals(value)) {
                return ut;
            }
        }
        return null;
    }

    public String getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }
}
